/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms.Design;

namespace DaveSexton.DocProject.ExternalUI
{
	internal sealed class UIService : IUIService
	{
		#region Public Properties
		public System.Collections.IDictionary Styles
		{
			get
			{
				throw new NotImplementedException();
			}
		}
		#endregion

		#region Private / Protected
		private readonly ProgramForm owner;
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="UIService" /> class.
		/// </summary>
		public UIService(ProgramForm owner)
		{
			if (owner == null)
				throw new ArgumentNullException("owner");

			this.owner = owner;
		}
		#endregion

		#region Methods
		public bool CanShowComponentEditor(object component)
		{
			return false;
		}

		public System.Windows.Forms.IWin32Window GetDialogOwnerWindow()
		{
			return owner;
		}

		public void SetUIDirty()
		{
			owner.IsDirty = true;
		}

		public bool ShowComponentEditor(object component, System.Windows.Forms.IWin32Window parent)
		{
			throw new NotImplementedException();
		}

		public System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form form)
		{
			if (form == null)
				throw new ArgumentNullException("form");

			return form.ShowDialog(owner);
		}

		public void ShowError(Exception ex, string message)
		{
			owner.ShowError(ex, message, Resources.Text.GeneralExceptionCaption);
		}

		public void ShowError(Exception ex)
		{
			owner.ShowError(ex, Resources.Text.GeneralExceptionCaption);
		}

		public void ShowError(string message)
		{
			owner.ShowError(message, Resources.Text.GeneralExceptionCaption);
		}

		public System.Windows.Forms.DialogResult ShowMessage(string message, string caption, System.Windows.Forms.MessageBoxButtons buttons)
		{
			return owner.ShowMessage(message, caption, buttons);
		}

		public void ShowMessage(string message, string caption)
		{
			owner.ShowMessage(message, caption, System.Windows.Forms.MessageBoxButtons.OK);
		}

		public void ShowMessage(string message)
		{
			owner.ShowMessage(message, Resources.Text.GeneralMessageCaption, System.Windows.Forms.MessageBoxButtons.OK);
		}

		public bool ShowToolWindow(Guid toolWindow)
		{
			throw new NotImplementedException();
		}
		#endregion
	}
}
